from django.contrib import admin
from django.urls import path
from django.conf.urls import include
from rest_framework.routers import DefaultRouter
from snippets import views

router = DefaultRouter()
# 各个方法将解析为类似'snippet-detail'等，@action装饰的如'snippet-函数名'
router.register('users', views.UserViewSet, basename='user')
router.register('snippets', views.SnippetViewSet, basename='snippet')

urlpatterns = [
    # path('snippets/', views.SnippetList.as_view(), name='snippet-list'),
    # path('snippets/<int:pk>/', views.SnippetDetail.as_view(), name='snippet-detail'),
    # path('snippets/<int:pk>/highlight/', views.SnippetHighlight.as_view(), name='snippet-highlight'),
    # path('users/', views.UserList.as_view(), name='user-list'),
    # path('users/<int:pk>/', views.UserDetail.as_view(), name='user-detail'),
    # path('', views.api_root)
    path('', include(router.urls)),
]